package com.marry.web;

import com.marry.entity.Bless;
import com.marry.model.Result;
import com.marry.repository.BlessRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 祝福
 */
@RestController
@RequestMapping("/sys/bless")
public class BlessController {

    @Autowired
    private BlessRepository blessRepository;

    /**
     * 保存
     */
    @PostMapping("/save")
    public Result save(@RequestBody Bless bless) {
        blessRepository.save(bless);
        List<Bless> list = blessRepository.findAll();
        return Result.ok(list);
    }

    /**
     * 获取
     */
    @PostMapping("/list")
    public Result list() {
        List<Bless> list = blessRepository.findAll();
        return Result.ok(list);
    }
}
